<template>
  <view>
    <form @submit="onSubmit">
      <view>
        <view>故障详情：</view>
        <input type="text" name="faultdetail" v-model="formData.faultdetail" placeholder="请输入故障详情" />
      </view>
      
      <view>
        <view>异常发生时间：</view>
        <input type="date" name="time" v-model="formData.time" />
      </view>
      
      <view>
        <button form-type="submit" type="primary">提交表单</button>
        <button form-type="reset">重置表单</button>
      </view>
      
      {{ obj }}
    </form>
  </view>
</template>

<script>
export default {
  data() {
    return {
      formData: {
        faultdetail: '',
        time: ''
      },
      obj: null
    };
  },
  methods: {
    onSubmit(e) {
      e.preventDefault(); // 防止表单默认提交
      console.log(e.target.detail.value);
      this.obj = e.target.detail.value;
    }
  }
}
</script>

<style lang="scss">
  input, textarea { border: 1px solid #eee; }
  form {
    padding: 20rpx;
  }
  view {
    margin-bottom: 20rpx;
  }
</style>